const fs = require("fs")

fs.readFile("./text.txt", 'utf8', (err, data) => {
  if(err){
    console.error(err);
  }else{
    console.log("data ==> ", data);
  }
})

try {
  const data = fs.readFileSync("./text.txt", 'utf8')
  console.log(data);
} catch (error) {
  
}